package com.noname.lib_base_java.net.download;

import android.os.Parcel;
import android.os.Parcelable;

import com.noname.lib_base_java.net.BaseApi;

/**
 * Author: Lmoumou
 * Date: 2019-01-22 11:27
 * 文件名: DownloadInfo
 * 描述:
 */
public class DownloadInfo implements Parcelable {
    /* 存储位置 */
    private String savePath;
    /* 文件总长度 */
    private long contentLength = 0;
    /* 下载长度 */
    private long readLength = 0;
    /* 下载该文件的url */
    private String url;
    /*下载的文件名*/
    private String fileName;
    /*解压是否成功*/
    private int zipSuc;
//    private BaseApi service;
    /*词本名称*/
    private String thesaurus_name;
    /*词本id*/
    private String thesaurus_id;
    /*下载信息储存地址*/
    private String infoSavePath;
    /*是否正在下载*/
    private int isDownload=-1;

    public int getIsDownload() {
        return isDownload;
    }

    public void setIsDownload(int isDownload) {
        this.isDownload = isDownload;
    }

    public String getInfoSavePath() {
        return infoSavePath;
    }

    public void setInfoSavePath(String infoSavePath) {
        this.infoSavePath = infoSavePath;
    }

    public String getThesaurus_name() {
        return thesaurus_name;
    }

    public void setThesaurus_name(String thesaurus_name) {
        this.thesaurus_name = thesaurus_name;
    }

    public String getThesaurus_id() {
        return thesaurus_id;
    }

    public void setThesaurus_id(String thesaurus_id) {
        this.thesaurus_id = thesaurus_id;
    }

    public int isZipSuc() {
        return zipSuc;
    }

    public void setZipSuc(int zipSuc) {
        this.zipSuc = zipSuc;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getSavePath() {
        return savePath;
    }

    public void setSavePath(String savePath) {
        this.savePath = savePath;
    }

    public long getContentLength() {
        return contentLength;
    }

    public void setContentLength(long contentLength) {
        this.contentLength = contentLength;
    }

    public long getReadLength() {
        return readLength;
    }

    public void setReadLength(long readLength) {
        this.readLength = readLength;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

//    public BaseApi getService() {
//        return service;
//    }
//
//    public void setService(BaseApi service) {
//        this.service = service;
//    }

    @Override
    public String toString() {
        return "DownloadInfo{" +
                "savePath='" + savePath + '\'' +
                ", contentLength=" + contentLength +
                ", readLength=" + readLength +
                ", url='" + url + '\'' +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.savePath);
        dest.writeLong(this.contentLength);
        dest.writeLong(this.readLength);
        dest.writeString(this.url);
        dest.writeString(this.fileName);
        dest.writeInt(this.zipSuc);
        dest.writeString(this.thesaurus_name);
        dest.writeString(this.thesaurus_id);
        dest.writeString(this.infoSavePath);
        dest.writeInt(this.isDownload);
    }

    public DownloadInfo() {
    }

    protected DownloadInfo(Parcel in) {
        this.savePath = in.readString();
        this.contentLength = in.readLong();
        this.readLength = in.readLong();
        this.url = in.readString();
        this.fileName = in.readString();
        this.zipSuc = in.readInt();
        this.thesaurus_name = in.readString();
        this.thesaurus_id = in.readString();
        this.infoSavePath = in.readString();
        this.isDownload = in.readInt();
    }

    public static final Parcelable.Creator<DownloadInfo> CREATOR = new Parcelable.Creator<DownloadInfo>() {
        @Override
        public DownloadInfo createFromParcel(Parcel source) {
            return new DownloadInfo(source);
        }

        @Override
        public DownloadInfo[] newArray(int size) {
            return new DownloadInfo[size];
        }
    };
}
